<template>
  <div>
    <a-table
      ref="table"
      size="middle"
      bordered
      rowKey="id"
      :columns="columns1"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      @change="handleTableChange"
    >
      <span slot="action" slot-scope="text, record">
        <a-icon type="vertical-align-bottom" @click="handleDownloadFile(record.url)"></a-icon>
      </span>
    </a-table>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { columns1 } from '../indexColumns'
export default {
  mixins: [JeecgListMixin],
  props: ['planId'],
  data() {
    return {
      columns1: columns1(this),
      dataSource: [],
      url: {
        // list: '/sjzyzhgl/sjAuditOrg/list'
        list: '/incon/inconReviewPlan/queryFileList',
      },
      disableMixinCreated: true,
    }
  },
  updated() {
    // this.checkId()
  },
  methods: {
    // getTableData(row) {
    //   debugger
    //   this.url.list = `${this.url.list}&planId=${val}&fileType=yearPlan`
    //   this.loadData()
    // },
    handleDownloadFile(fileUrl) {
      this.$message.success('正在下载，请稍等！')
      let url = `${window._CONFIG['domianURL']}/sys/common/download/${fileUrl}`
      window.open(url, '_blank')
    },
  },
  watch: {
    planId: {
      handler(val) {
        this.url.list = `${this.url.list}?planId=${val}&fileType=yearPlan`
        this.loadData()
      },
      deep: true,
      immediate: true,
    },
  },
}
</script>

<style>
</style>